package cn.edu.scau.cmi.xuandingcong.factory;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;

public class FactoryDomain {
	@FXML
	private TextArea ta;
	
	@FXML
	private ComboBox cb2;
	@FXML
	private Button b;
	
	PorkMeatFactory pork = new PorkMeatFactory();
	BeefMeatFactory beef = new BeefMeatFactory();
	ChickenMeatFactory chicken = new ChickenMeatFactory();
	public void factoryDomain() {
		b.setOnAction(new EventHandler<ActionEvent>() {
			
			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				if(cb2.getValue().equals("猪肉")) {
				ta.appendText(pork.factory().Operation()+"\n");
			}
			if(cb2.getValue().equals("牛肉")) {
				ta.appendText(beef.factory().Operation()+"\n");
			}
			if(cb2.getValue().equals("鸡肉")) {
				ta.appendText(chicken.factory().Operation()+"\n");
			}
			}
		});
			
		
		
		
	}
	
}
